const mongoose = require("./db");
const userSchema = new mongoose.Schema({
  username: { type: String, required: true, unique: true },
  password: { type: String, required: true },
});
const userModel = mongoose.model("user", userSchema, "user");

const messageSchema = new mongoose.Schema({
  from: String, // 发送者id
  to: String, // 接收者id
  content: String,
  image: String, // 图片消息可选
  isImage: Boolean,
  timestamp: Number,
});
const messageModel = mongoose.model("message", messageSchema);

module.exports = { userModel, messageModel };
